import { pageCategory } from '@/api/category'

const state = {
  categorys: [],
}

const mutations = {

  PAGE_CATEGORY: (state, data) => {
    state.categorys = data
  }
}

const actions = {

  pageCategory({ commit, state },_data) {
    return new Promise((resolve, reject) => {
      pageCategory(_data).then(data=> {
        commit('PAGE_CATEGORY',data)
        resolve()
      }).catch(error => {
        reject(error)
      })
    })
  },
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

